package com.yugao.fintech.framework.desensitization.fieldbind;

import com.yugao.fintech.framework.desensitization.annotations.FieldBind;
import com.yugao.fintech.framework.desensitization.fieldbind.inter.IFieldBindAnnotationDataGetter;
import com.yugao.fintech.framework.desensitization.fieldbind.model.AnnotationMetadata;
import org.springframework.stereotype.Component;

@Component
public class DefaultFieldBindAnnotationGetter implements IFieldBindAnnotationDataGetter<FieldBind> {
    @Override
    public AnnotationMetadata initFieldBindAnnotation(FieldBind fieldBind) {
        return AnnotationMetadata.builder().type(fieldBind.type())
                .target(fieldBind.target())
                .targetEqCode(fieldBind.targetEqCode())
                .mapperTarget(fieldBind.mapperTarget()).codeDefault(fieldBind.codeDefault())
                .delimiter(fieldBind.delimiter()).targetDelimiter(fieldBind.targetDelimiter())
                .build();
    }
}
